<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>

    <div id="app">
        <form>
            <!-- 基本表单 -->
            <div>
                <label for="user">用户名</label>
                <input type="text" name="" id="user" v-model="user">
                {{user}}
            </div>
            <!-- 基本表单 ----- 不用v-model -->
            <div>
                <label for="age">年龄</label>
                <input type="text" id="age" ref="age" :value="age" @input="changeAgeFl($event)">
                {{age}}
            </div>
            <!-- 复选框 -->
            <div>
                <label for="">全选</label>
                <input type="checkbox" v-model="all">
                {{all}}
            </div>
            <!-- 复选框 ----不用v-model  -->
            <div>
                <label for="">全选</label>
                <input type="checkbox" :checked="quan" @change="changeFl($event)">
                {{quan}}
            </div>
            <div>
                <input type="text" v-model.trim.number.lazy="s" name="" id="">
                {{s}} -- {{s.length}}  -- {{typeof s}}
            </div>
        </form>

    </div>

    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    user: 'jiang',
                    age: '19',
                    all: true,
                    quan: true,
                    s: ''
                }
            },
            methods: {
                changeAgeFl(e) {
                    this.age = e.target.value
                },
                changeFl(e) {
                    this.quan = e.target.checked
                }
            }
        })
    </script>

</body>

</html>